<script language="javascript" type="text/javascript">       
    addTab("<?php echo Core_Util::escapeForJS($this->store->getName());?>",'<?php echo $this->url(array('action' => 'list'))?>');
</script>
<table border="0" class="bread-crumb">
	<tr>
		<td ><?php echo $this->partial('breadcrum-menu.phtml', array('new_orders' => $this->new_orders, 'id_store' => $this->store->id)) ?></td>
        <td style="text-align: right;">
			<a class="underline non_space" href="<?php echo $this->url(array('module' => 'store','controller' => 'product', 'action' => 'create', 'id_store' => $this->store->id), null, true); ?>">
				<img src="img/add.png" class="bordernone" height="11" width="11" /><?php echo $this->translate('NEW_PRODUCT_LABEL') ?>
			</a>
		</td>
	</tr>
</table>
<div class="order_detail_container">
    <?php echo $this->partial("markDetailMessage.phtml", array('cart' => $this->cart)); ?>
    
    <?php echo $this->partial("displayErrorMessages.phtml", array('error_messages' => $this->error_messages)); ?>

    <div class="order_detail">
        <h4 class="order_subject"><?php echo sprintf($this->translate('TITLE_ORDER_ID_NUMBER'), $this->escape($this->cart->id));?></h4>
        <p class="sender_info">
            <?php 
                if(!empty($this->cart->link)):
                    echo sprintf($this->translate('SENDER_NAME'), '<a target="_blank" href="' . $this->escape($this->cart->link) . '">' . $this->escape($this->cart->user_name) . '</a>');
                else:
                    echo sprintf($this->translate('SENDER_NAME'), '<span>' . $this->escape($this->cart->user_name) . '</span>');
                endif;
            ?>
        </p>
        <p class="sender_info"><?php echo sprintf($this->translate('SENDER_EMAIL'), '<span>' . $this->escape($this->cart->user_email) . '</span>'); ?></p>
        <p class="sender_info"><?php echo sprintf($this->translate('SENDER_PHONE'), '<span>' . $this->escape($this->cart->user_phone). '</span>'); ?></p>
        <p class="sender_info"><?php echo sprintf($this->translate('SENDER_LOCATION'), '<span>' . $this->escape($this->cart->user_location). '</span>'); ?></p>
        <p class="sender_info"><?php echo sprintf($this->translate('SENDER_TIME'), '<span>' . date($this->translate("FORMAT_DATE"), $this->cart->time_sent). '</span>'); ?></p>
        
    </div>
    
    <table class="tbl_cart_products" id="tbl_cart_products">
        <thead>
            <tr>
                <th>
                    <span class="tbl_item_name">
                        <?php echo $this->translate('CART_ITEM_NAME') ?>
                    </span>
                </th>
                <th>
                    <span class="tbl_quantity">
                        <?php echo $this->translate('CART_ITEM_QUANTITY') ?>
                    </span>
                </th>
                <th>
                    <span class="tbl_payment">
                        <?php echo $this->translate('CART_ITEM_PAYMENT') ?>
                    </span>
                </th>
            </tr>
        </thead>
        <tbody>
            <?php
                if(count($this->list_products)):
                    $total_payment = 0;
                    foreach ($this->list_products as $key => $product):	
                        if($product['cart_price'] != null){
                            $total_payment += $product['cart_price'] * $product['quantity'];
                        }
            ?>
            <tr class="cart_product_row">
                <td>
                    <div class="product_cover">
                        <a target="_blank" href="<?php echo $this->social->pageUrl(array('target' => 'detail', 'id_product' => $product->id), $this->cart->id_page) ;?>">
                            <img alt="thumbnail" src="<?php echo UPLOAD_URL . '/product/thumbnail/' .  $product['image'];?>">
                        </a>
                    </div>
                    <div class="product_info">
                        <p class="product_name">
                            <a target="_blank" href="<?php echo $this->social->pageUrl(array('target' => 'detail', 'id_product' => $product->id), $this->cart->id_page) ;?>">
                                <?php echo $this->escape($product['name']) ?>
                            </a>
                        </p>
                        <?php if(!empty($product['sku'])):?>
                        <p class="product_SKU">
                            <label><?php echo $this->translate('SKU'); ?>:</label>
                            <span><?php echo $this->escape($product['sku']);?></span>
                        </p>
                        <?php endif;?>
                        <p class="price_info">
                            <span class="price">
                                <?php
                                    if($product['cart_price'] != null){
                                        $product_price = Core_Util::formatPrice($this->store->unit_code, $product['cart_price']);
                                        echo sprintf('%s %s', $product_price, $this->store->getCurrency());
                                    } else {
                                        echo 'N/A';
                                    }
                                ?>
                            </span>
                        </p>
                    </div>
                </td>
                <td>
                    <p class="quantity">
                        <span><?php echo $product['quantity'];?></span>
                    </p>
                </td>
                <td>            
                    <p class="payment">
                        <span>
                            <?php 
                                if($product['cart_price'] != null){
                                    $row_price = Core_Util::formatPrice($this->store->unit_code, $product['cart_price'] * $product['quantity']);
                                
                                    echo sprintf('%s %s', $row_price, $this->store->getCurrency());
                                } else {
                                    echo 'N/A';
                                }
                            ?>
                        </span>
                    </p>
                </td>
            </tr>
            <?php 
                    endforeach;
                else:
            ?>
            <tr id="empty_cart_row">
                <td colspan="4" class="empty_cart">
                    <?php echo $this->translate('MSG_EMPTY_CART');?>
                </td>
            </tr>
            <?php endif;?>
            <tr class="end_row">
                <td colspan="2" class="td_update">
                    <span class="btn_update_cart"><?php echo $this->translate('TOTAL_PAYMENT');?></span>
                </td>
                <td class="total_payment">
                    <span>
                        <?php 
                            $total_price = Core_Util::formatPrice($this->store->unit_code, $total_payment); 
                            echo sprintf('%s %s', $total_price, $this->store->getCurrency());
                        ?>
                    </span>
                </td>
            </tr>
        </tbody>
    </table>
    <?php if(!empty($this->cart->user_note)):?>
        <div class="order_content">
            <h4><?php echo $this->translate('BUYER_NOTE');?></h4>
            <p><?php echo nl2br($this->escape($this->cart->user_note));?></p>
        </div>
    <?php endif;?>
    <?php
        $this->form_note->setAction($this->url(array('action' => 'note')));
        echo $this->form_note; 
    ?>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        canvasScrollTo(0, 0);
    });
</script>